Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ros2] gazebo_ros_force plugin #784

Merged
merged 5 commits into from
Jul 30, 2018
Merged

[ros2] gazebo_ros_force plugin #784

merged 5 commits into from
Jul 30, 2018

Conversation

chapulina
Copy link
Contributor

@chapulina chapulina commented Jul 28, 2018

  • Ported plugin without changing behaviour
  • Make use of new SDF param parsing
  • Use gazebo::ServerFixture for testing
  • Add demo world, see instructions on the file
  • Start a series of conversion functions, the idea is to keep filling it with handy conversions between ROS / Gazebo / SDF / Ignition (Math/Msgs) types

ros2force

Copy link
Collaborator

@kev-the-dev kev-the-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good and all tests pass, just some small comments

include_directories(include)
include_directories(
include
${gazebo_dev_INCLUDE_DIRS}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is needed? Thought include was added with ament_target_dependencies also

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it fails to find the ign-math includes for me

@@ -46,6 +65,11 @@ ament_package()
install(DIRECTORY include/
DESTINATION include)

install(TARGETS gazebo_ros_force
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can just have one install target for all the plugins

install(TARGETS
  gazebo_ros_force
  gazebo_ros_template
  ARCHIVE DESTINATION lib
  LIBRARY DESTINATION lib
  RUNTIME DESTINATION bin)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call, done 0cc0e06

target_link_libraries(gazebo_ros_force
${gazebo_ros_LIBRARIES}
${geometry_msgs_LIBRARIES}
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Want to make sure these lines and the include_directories lines are needed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to work ok without the link libs now. I know I originally added them for a reason... Weird... The include still seems to be needed, but removed libs: 0cc0e06

Send an empty / zero message to stop applying a force.

Example Usage:
\verbatim
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think \code{.xml} shows up better

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It sounds like it should, so changed 0cc0e06

impl_->wrench_msg_.force =
gazebo_ros::Convert<geometry_msgs::msg::Vector3>(ignition::math::Vector3d::Zero);
impl_->wrench_msg_.torque =
gazebo_ros::Convert<geometry_msgs::msg::Vector3>(ignition::math::Vector3d::Zero);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe these will already be zeroed out by the default constructor

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh you're right, here's a handy reference. I'll update.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// Wait until box moves
unsigned int sleep = 0;
unsigned int max_sleep = 30;
while (sleep < max_sleep && abs(box->WorldPose().Pos().X()) < tol) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps there should be a larger tolerance for seeing that it moved. 10e-10 could just be the initial rounding error

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, increased in 0cc0e06

Copy link
Collaborator

@kev-the-dev kev-the-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine to merge after copyright dates adjusted

@@ -0,0 +1,83 @@
// Copyright 2012 Open Source Robotics Foundation, Inc.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copyright year

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you referring to the lack of an end year, or to it being different from 2018? I think even after the refactoring, there's still enough left from the original plugin to keep the same initial year for each file.

Regarding the lack of a final year, take a look at this conversation.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh cool, thought end year was needed

@@ -0,0 +1,103 @@
// Copyright 2013 Open Source Robotics Foundation, Inc.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Year

@chapulina chapulina merged commit d5af0f7 into ros2 Jul 30, 2018
@dhood dhood deleted the ros2_force_plugin branch August 10, 2018 18:36
@dhood
Copy link
Collaborator

dhood commented Aug 17, 2018

Example usage (for copy paste if anyone needs it in the future):

gazebo ~/ros2_ws/src/ros2/gazebo_ros_pkgs/gazebo_plugins/test/worlds/gazebo_ros_force.world 
ros2 topic pub /test/force_test -1 geometry_msgs/Wrench "force: {x: 10}"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants